<template>

</template>
    <div>
        <el-button mb-2 @click="toggle">Switch Language</el-button>
        <br />
        <el-config-provider :locale="locale"/>
    </div>
<script setup lang="ts" name="Switch">
    import { computed, ref } from 'vue'
    import zhCn from 'element-plus/es/locale/lang/zh-cn.mjs'
    import en from 'element-plus/es/locale/lang/en.mjs'

    const language = ref('zh-cn')
    const locale = computed(() => (language.value === 'zh-cn' ? zhCn : en))

    const toggle = () => {
      language.value = language.value === 'zh-cn' ? 'en' : 'zh-cn'
    }
</script>

<style>

</style>